//
//  UserManger.m
//  WhatsChat
//
//  Created by lanou3g on 16/3/24.
//  Copyright © 2016年 tanchen. All rights reserved.
//

#import "UserManger.h"

static UserManger *userManager;

@implementation UserManger

+ (instancetype)manager {
    static dispatch_once_t token ;
    dispatch_once(&token, ^{
        userManager = [[UserManger alloc] init];
    });
    return userManager;
}
//查找用户的方法
- (void)findUsersByPartname:(NSString *)partName withBlock:(AVArrayResultBlock)block {
    AVQuery *q = [AVUser query];
    [q setCachePolicy:kAVCachePolicyNetworkElseCache];
    //包含查询
    [q whereKey:@"username" containsString:partName];
    AVUser *curUser = [AVUser currentUser];
    //不包括用户自己  notEqualTo
    [q whereKey:@"objectId" notEqualTo:curUser.objectId];
    //根据注册的日期的先后显示
    [q orderByDescending:@"updatedAt"];
    [q findObjectsInBackgroundWithBlock:block];
}


@end
